set -e

# Convert model from megatron to huggingface
TP="1"
PP="8"
MODEL_PATH="/mnt/home/opsfm-xz/sft_checkpoint/xz/Qwen1.5-14B-Chat-megatron-tp1-pp8-umac-token2x-sharegpt-owl-sft-8000step/checkpoint/dsw-pretrain-megatron-gpt3-14B-lr-5e-5-bs-4-seqlen-512-pr-fp16-tp-1-pp-8-ac-sel-do-true-sp-false-tt--wt-/iter_0008000"
OUTPUT_PATH="/mnt/home/opsfm-xz/sft_checkpoint/xz/Qwen1.5-14B-Chat-megatron-tp1-pp8-umac-token2x-sharegpt-owl-sft-8000step/checkpoint/dsw-pretrain-megatron-gpt3-14B-lr-5e-5-bs-4-seqlen-512-pr-fp16-tp-1-pp-8-ac-sel-do-true-sp-false-tt--wt-/iter_0008000/converted_model"
MODEL_TYPE="qwen1.5-14b"
EXTRA_VOCAB_SIZE="0"

cd /mnt/tenant-home_speed/xz/Pai-Megatron-Patch/toolkits/model_checkpoints_convertor/qwen
bash hf2megatron_convertor.sh ../../../ "${MODEL_PATH}" "${OUTPUT_PATH}" ${TP} ${PP} "${MODEL_TYPE}" "${EXTRA_VOCAB_SIZE}" true
